#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main()
{
	char *str = (char *)malloc(100);
	strcpy(str, "xiaozhi");	// xiaozhi
	printf("%s\n", str);
	free(str);
	
	if (str != NULL) {
		strcpy(str, "wise");
		printf("%s\n", str);	// wise
	}
}

#if 0
/*
 * intel
 */
0000000000001189 <main>:
    1189:	f3 0f 1e fa          	endbr64 
    118d:	55                   	push   %rbp
    118e:	48 89 e5             	mov    %rsp,%rbp
    1191:	48 83 ec 10          	sub    $0x10,%rsp
    1195:	bf 64 00 00 00       	mov    $0x64,%edi
    119a:	e8 f1 fe ff ff       	callq  1090 <malloc@plt>
    119f:	48 89 45 f8          	mov    %rax,-0x8(%rbp)
    11a3:	48 8b 45 f8          	mov    -0x8(%rbp),%rax
    11a7:	48 ba 78 69 61 6f 7a 	movabs $0x69687a6f616978,%rdx
    11ae:	68 69 00 
    11b1:	48 89 10             	mov    %rdx,(%rax)
    11b4:	48 8b 45 f8          	mov    -0x8(%rbp),%rax
    11b8:	48 89 c7             	mov    %rax,%rdi
    11bb:	e8 c0 fe ff ff       	callq  1080 <puts@plt>
    11c0:	48 8b 45 f8          	mov    -0x8(%rbp),%rax
    11c4:	48 89 c7             	mov    %rax,%rdi
    11c7:	e8 a4 fe ff ff       	callq  1070 <free@plt>
    11cc:	48 83 7d f8 00       	cmpq   $0x0,-0x8(%rbp)
    11d1:	74 1a                	je     11ed <main+0x64>
    11d3:	48 8b 45 f8          	mov    -0x8(%rbp),%rax
    11d7:	c7 00 77 69 73 65    	movl   $0x65736977,(%rax)
    11dd:	c6 40 04 00          	movb   $0x0,0x4(%rax)
    11e1:	48 8b 45 f8          	mov    -0x8(%rbp),%rax
    11e5:	48 89 c7             	mov    %rax,%rdi
    11e8:	e8 93 fe ff ff       	callq  1080 <puts@plt>
    11ed:	b8 00 00 00 00       	mov    $0x0,%eax
    11f2:	c9                   	leaveq 
    11f3:	c3                   	retq   
    11f4:	66 2e 0f 1f 84 00 00 	nopw   %cs:0x0(%rax,%rax,1)
    11fb:	00 00 00 
    11fe:	66 90                	xchg   %ax,%ax

/*
 * arm
 */
000000000040068c <main>:
  40068c:	a9be7bfd 	stp	x29, x30, [sp, #-32]!
  400690:	910003fd 	mov	x29, sp
  400694:	d2800c80 	mov	x0, #0x64                  	// #100
  400698:	97ffffa6 	bl	400530 <malloc@plt>
  40069c:	f9000fa0 	str	x0, [x29, #24]
  4006a0:	f9400fa0 	ldr	x0, [x29, #24]
  4006a4:	90000001 	adrp	x1, 400000 <_init-0x4f8>
  4006a8:	911ee021 	add	x1, x1, #0x7b8
  4006ac:	f9400021 	ldr	x1, [x1]
  4006b0:	f9000001 	str	x1, [x0]
  4006b4:	f9400fa0 	ldr	x0, [x29, #24]
  4006b8:	97ffffae 	bl	400570 <puts@plt>
  4006bc:	f9400fa0 	ldr	x0, [x29, #24]
  4006c0:	97ffffb0 	bl	400580 <free@plt>
  4006c4:	f9400fa0 	ldr	x0, [x29, #24]
  4006c8:	f100001f 	cmp	x0, #0x0
  4006cc:	54000160 	b.eq	4006f8 <main+0x6c>  // b.none
  4006d0:	f9400fa2 	ldr	x2, [x29, #24]
  4006d4:	90000000 	adrp	x0, 400000 <_init-0x4f8>
  4006d8:	911f0001 	add	x1, x0, #0x7c0
  4006dc:	aa0203e0 	mov	x0, x2
  4006e0:	b9400022 	ldr	w2, [x1]
  4006e4:	b9000002 	str	w2, [x0]
  4006e8:	b8401021 	ldur	w1, [x1, #1]
  4006ec:	b8001001 	stur	w1, [x0, #1]
  4006f0:	f9400fa0 	ldr	x0, [x29, #24]
  4006f4:	97ffff9f 	bl	400570 <puts@plt>
  4006f8:	52800000 	mov	w0, #0x0                   	// #0
  4006fc:	a8c27bfd 	ldp	x29, x30, [sp], #32
  400700:	d65f03c0 	ret
  400704:	00000000 	.inst	0x00000000 ; undefined


#endif

